﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>外键枚举列表</title>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <link href="../../Scripts/easyUI/themes/gray/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
     <base target="_self" /> 
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" >
        function SetIt(val) {
        
            if (parent && parent.window && typeof parent.window.doCloseDialog === 'function') {
                var ctl_id = GetQueryString("ctl_id");
                parent.$("#" + ctl_id).val(val);
                parent.window.doCloseDialog.call();
            } else {
                window.returnValue = val;
                window.close();
            }
        }
        /* ESC Key Down */
        function Esc() {
       
//            if (event.keyCode == 27)
//                window.close();
            return true;
        }

        //页面启动函数.
        $(function () {
       
            $("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");

            InitPage();

            $("#Msg").html("");
        });

        //初始化数据.
        function InitPage() {
       
            var fk_mapData = GetQueryString("FK_MapData");

            //初始化表格.
            $.ajax({
                type: 'post',
                async: true,
                url: Handler + "?DoType=ImpTableFieldSelectBindKey_Init&FK_MapData=" + fk_mapData + "&m=" + Math.random(),
                dataType: 'html',
                success: function (data) {

                    if (data.indexOf('err@') == 0) {
                        alert(data);
                        return;
                    }

                   
                    
                    data = JSON.parse(data);
                    var enumMain = data["EnumMain"];
                    var sfTables = data["SFTables"];

                    newRow = "<tr >";
                    newRow += "<th colspan=4 >外键表</td>";
                    newRow += "</tr>";
                    $("#Table1 tr:last").after(newRow);


                    //增加处理 外键表.
                    for (var i = 0; i < sfTables.length; i++) {

                        var sfTable = sfTables[i];

                        var newRow = "";
                        var nameLink = "";

                        newRow = "<tr ><td class=Idx>" + i + "</td>";
                        newRow += "<td>" + sfTable.No + "</td>";
                        newRow += "<td><a href=\"javascript:SetIt('" + sfTable.No + "')\">" + sfTable.Name + "</a></td>";
                        newRow += "<td>" + sfTable.PTable + "</td>";
                        newRow += "</tr>";

                        $("#Table1 tr:last").after(newRow);
                    }

                    newRow = "<tr >";
                    newRow += "<th colspan=4 >枚举值</td>";
                    newRow += "</tr>";
                    $("#Table1 tr:last").after(newRow);

                    //增加处理 枚举值.
                    for (var i = 0; i < enumMain.length; i++) {

                        var enum2 = enumMain[i];

                        var newRow = "";
                        newRow = "<tr ><td class=Idx>" + i + "</td>";
                        newRow += "<td>" + enum2.No + "</td>";
                        newRow += "<td><a href=\"javascript:SetIt('" + enum2.No + "')\">" + enum2.Name + "</a></td>";
                        newRow += "<td>" + sfTable.CfgVal + "</td>";
                        newRow += "</tr>";

                        $("#Table1 tr:last").after(newRow);
                    }
                }

            });
        }
     </script>
</head>
<body onkeypress="Esc()" >

<table id="Table1" style=" width:98%; ">
<caption>枚举/外键列表</caption>
<tr>
<th>序</th>
<th>编号</th>
<th>名称</th>
<th>描述</th>
</tr>
</table>

<div id="Msg"></div>

</body>
</html>
